package cn.wolfcode.p2p.business.service.impl;

import cn.wolfcode.p2p.business.domain.SystemAccount;
import cn.wolfcode.p2p.business.mapper.SystemAccountMapper;
import cn.wolfcode.p2p.business.service.ISystemAccountService;
import cn.wolfcode.p2p.util.AssertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SystemAccountServiceImpl implements ISystemAccountService {
        @Autowired
        private SystemAccountMapper systemAccountMapper;

        @Override
        public SystemAccount getSystemAccount() {

                return systemAccountMapper.getAccount();
        }

        @Override
        public void update(SystemAccount systemAccount) {
                AssertUtil.instance().isFalse(systemAccountMapper.updateByPrimaryKey(systemAccount)==0,"更新系统账户失败!乐观锁异常!");
        }
}
